package cat.sun.adapters;

import java.util.List;


import android.content.Context;
import android.graphics.Typeface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import cat.sun.R;
import cat.sun.data.PlayListItem;

public class PlayDialogAdapter extends BaseAdapter
{
		private LayoutInflater inflater;
		private Context context;
		private List<PlayListItem> items;
		
		public static int defaultWidth = 1;
		public static int defaultHeight = 1;
		public static int defaultBombs = 0;
		
		public int currHeight;
		public int currWidth;
		public int currBombs;
				
		public PlayDialogAdapter(Context activity, List<PlayListItem> items)
		{
			this.inflater = LayoutInflater.from(activity);
			this.context = activity;
			this.items = items;
			currHeight = PlayDialogAdapter.defaultHeight;
			currWidth = PlayDialogAdapter.defaultWidth;
			currBombs = PlayDialogAdapter.defaultBombs;
			
		}
		
		@Override
		public int getCount() 
		{
			return items.size();
		}

		@Override
		public Object getItem(int arg0) 
		{
			return null;
		}

		@Override
		public long getItemId(int position) 
		{
			return position;
		}

		@Override
		public View getView(final int position, View convertView, final ViewGroup parent) 
		{
			if (convertView == null)  convertView = this.inflater.inflate(R.layout.item_play_dialog, null);

			TextView title = (TextView) convertView.findViewById(R.id.dialog_play_level);
			final TextView bombs = (TextView) convertView.findViewById(R.id.dialog_play_bombs);
			final TextView size = (TextView) convertView.findViewById(R.id.dialog_play_size);
			
			bombs.setTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-Medium.ttf"));
			size.setTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-Medium.ttf"));
			title.setTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-Medium.ttf"));
			
			title.setText(items.get(position).getLevel());
			bombs.setText(items.get(position).getBombs());
			size.setText(items.get(position).getSize());
			
			return convertView;
		}
		
}
